#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int monster[N],vis[N],mini;
int main(){
	freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,flag=0;
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>monster[i];
        if(monster[i]>=3)flag=1;
    }
    if(flag==1){
        sort(monster+1,monster+1+n);
        mini=n;
        for(int i=1;i<n;++i)
        {
            for(int j=i+1;j<=n;++j)
            {
                if(monster[i]<monster[j]&&monster[i]!=0&&vis[j]==0)
                {
                    mini--;
                    monster[i]=0;
                    vis[j]=1;
                    break;
                }
            }
        }
        cout<<mini<<endl;
        return 0;
    }
    else
    {
        int ans1=0,ans2=0,x=0;;
        for(int i=1;i<=n;++i)
        {
            if(monster[i]==1)ans1++;
            else ans2++;
        }
        if(ans1>ans2)mini=n-ans2;
        else mini=n-ans1;
        cout<<mini<<endl;
        return 0;
    }
}
